New in WordPress 2.7 is the template tag wp_page_menu()
. This function creates a page navigation. As parameter you can add a menu “Home” with show_home , or whatever you like.
wp_page_menu('show_home=Home');
wp_page_menu()
is a wrap for wp_list_pages()
, which additionally add a link to the homepage and assign the class current_page_item
, if the starting page is active. For users who doesn’t know a lot about PHP, this will be a great help.
From the aspect of a theme developer, it might be a problem using CSS Frameworks, which uses their own classes and structure.
Comments
3 responses to “wp_page_menu in WordPress 2.7”
Cool! I was looking for something like this.
Hi, this function seems really useful for outputting a standard nested ul li ul…etc for creating global navigation. However, is it possible to inject custom markup or would I have to code my function tp generate the navigation with the markup I need?
cheers
Ollie: You can wrap the ul with a div like
wp_page_menu('menu_class=my_own_class&show_home=Home&depth=1')
where my_own_class is the class for the div.
Thats all.